
# CROSS_COMPILE=1

ifdef CROSS_COMPILE
ARCH = powerpc
KERNELDIR = /opt/wrlinux8sdk/kernel-source-32 
COMPILER = /opt/wrlinux8sdk/x86_64-fsl_t1xxx_32b-sdk/sysroots/x86_64-wrlinuxsdk-linux/usr/bin/powerpc-wrs-linux/powerpc-wrs-linux-
else
ARCH =$(shell uname -p) 
KERNELDIR ?= /lib/modules/$(shell uname -r)/build  
endif

obj-m := xdd.o
xdd-objs := proc_mod.o  
# xdd-objs := mmap_driver.o  
# xdd-objs := memmap.o  
# xdd-objs := hello.o  
# xdd-objs += cdevdemo.o  
# xdd-objs += cdev.o  
# xrmmod-objs += force_rmmod.o  

MAKE := make
PWD := $(shell pwd)  
default:  
	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules ARCH=$(ARCH) CROSS_COMPILE=$(COMPILER)
	mv -f *.o *.mod.c  modules.order  Module.symvers  obj/
clean:  
	rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions modules.order  Module.symvers  
	rm obj/*
